<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Hello WX</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <!-- <script src="https://i.sgcc.com.cn:18080/capsule/capsule.js"></script> -->
    <script src="../js/capsuleUtils.js"></script>
    <link rel="stylesheet" href="../css/mui.min.css" />
    <!--App自定义的css-->
    <link rel="stylesheet" type="text/css" href="../css/app.css" />
    <script src="../js/flexible.js"></script>
    <script src="../js/jquery-3.6.0.min.js"></script>
    <script src="../js/sm2.js"></script>
    <script src="../js/sm3.js"></script>
    <script src="../js/vue.js"></script>

    <script src="../js/sourtable.js"></script>
    <script src="../js/vuedraggable.js"></script>
    <script src="../common/wode/my.js"></script>
    <script src="../common/IntelligentAgent/home.js"></script>
    <!-- <script src="../common/dialogue/dialogue.js"></script> -->
    <link rel="stylesheet" href="../npl/css/vant.mini.css" />
    <link rel="stylesheet" href="../css/IntelligentAgent.css">
    <!-- <link rel="stylesheet" href="../css/elementui.css"> -->
    <script src="../js/elementui.js"></script>
    <script src="../js/vconsole.min.js"></script>
    <script src="../js/clipboard.js"></script>
    <script src="../js/mui.min.js"></script>
    <script src="../npl/js/vant.mini.js"></script>
    <script src="./text.js"></script>
    <!-- 亿榕使用 -->
    <link rel="stylesheet" href="./yr/chat/chat.css">
    <link rel="stylesheet" href="./yr/css/github-markdown.css" />
    <link rel="stylesheet" href="./yr/css/katex/katex.min.css" />
    <link rel="stylesheet" href="./yr/css/chooseDir.css" />
    <script src="./yr/js/util.js"></script>
    <script src="./yr/js/katex/katex.min.js"></script>
    <script src="./yr/js/katex/auto-render.min.js"></script>
    <script src="./yr/js/base64.js"></script>
    <script src="./yr/chat/index.js"></script>
    <script src="./yr/js/stream.js"></script>
    <script src="./yr/js/streamMsg.js"></script>
    <script src="./yr/js/marked.min.js" type="text/javascript"></script>
    <script src="./yr/js/turndown.js" type="text/javascript"></script>
    <script src="./yr/js/chooseDir.js"></script>
    <!-- 亿榕使用 -->
</head>
<style>
    #app {
        width: 100%;
        height: 100%;
        background-color: #fff;
    }

    .diolpop {
        position: relative;


    }

    .diolpop .van-tabs {
        display: flex;
        width: 100%;
        flex-direction: row-reverse
    }

    .diolpop .van-tabs__nav {
        height: 35%;
    }

    .diolpop .van-tabs__wrap {
        height: 90%;
        width: 8%;
        position: absolute;
        right: -8%;
        top: -1rem;
    }

    .diolpop .van-tabs .van-tabs--card {
        display: flex;
        /* flex-direction: row-reverse; */
    }

    .diolpop .van-tabs__content {
        display: block;
        width: 90%;

    }

    .diolpop .van-popup {
        overflow-y: visible !important;
        /* visible 表示允许超出，默认值 */
        width: 75% !important;
        height: 60% !important;
        background-color: transparent;
        /* background-color: #fff; */


    }

    .diolpop .van-tabs__content {
        height: 90%;


    }

    .diolpop .van-tabs__nav--card {
        height: 4rem;
        display: flex;

        margin: 0 !important;
        flex-direction: column;

    }

    .diolpop .van-tab {
        height: 33%;
        flex: none;

    }

    .diolpop .van-tab:nth-child(2) {
        margin: 0px !important
    }


    .pop_content {
        width: 100% !important;
        height: 85% !important;
        padding-top: 30%;
        background-color: transparent !important;
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }

    .bottom_del {
        position: absolute;
        /* background-color: red; */
        bottom: -30px;
        left: 0;
        width: 100%;
        height: 18%;
        display: flex;
        /* align-items: center; */
        justify-content: center;
    }

    .diolpop .van-popup--center {
        top: 45%;
        left: 50%;
    }

    .bottom_del_btn {
        width: .7rem;
        height: .7rem;
    }

    .bottom_del_btn img {
        width: 100%;
        height: 100%;
    }

    .pop_content_tabs {
        width: 100%;
        height: 100%;

        /* background-color: #ccc; */
    }

    .diolpop .van-tabs__nav--card .van-tab {
        color: #fff;
        border: none;
        margin-bottom: .2rem !important;
        border-radius: 0 8px 8px 0;
        font-size: 10px;
    }

    .diolpop .van-tabs__nav--card {
        border: none;
    }

    .diolpop .van-tabs__nav {
        background: none;
    }

    .diolpop .van-tab__text {
        display: flex;
        text-align: center;
        align-items: center;
        justify-content: center;
        line-height: .22rem;
    }

    .diolpop .van-tab__pane,
    .van-tab__pane-wrapper {
        height: 100%;
        padding: 0 .5rem .3Rem 0;
        overflow: auto;
    }

    .pop_content_tabs_item_title {
        font-size: 15px;
        font-weight: bold;
        color: black;
        margin-bottom: 10px;
    }

    .pop_content_tabs_item_content {
        font-size: 13px;
        margin-bottom: 10px;
        color: black;
    }
</style>

<body>
    <script type="text/x-template" id="chat-template">
        <div id="chat-body" v-cloak>
            <choose-dir ref="chooseDirRef" :yr-dir="false"
                @choose-dir-upload="chooseDirUpload"></choose-dir>
            <div class="is-loading">
                <div class="curtain">
                    <div class="loadingBgc">
                        <div class="loader"></div>
                    </div>
                </div>
            </div>
            <div id="chatTypeDialog" v-if="showDeepSeekPop" class="header_llm">
                <div style="padding:0.3rem">
                    <div class="header_llm_item" :style="deepSeekItem.name == item.name ? 'background-color: #EBF0FD;' : ''" v-for="item in deepSeekActions" @click="handleDeepSeekSelect(item)">
                        <img class="header_llm_item_icon" :src="item.icon2"/>{{item.name}}<img v-if="deepSeekItem.name == item.name" class="header_llm_item_icon_select" src="./yr/images/select-blue.png"/>
                    </div>
                </div>
            </div>
            <div class="trainTickets">
                <div class="header_tit">
                    <van-nav-bar :border=false left-arrow style="position: unset !important;">
                        <template #left>
                            <div class="back_l active-brightness" @click="home" v-if="!isPlay">
                                <img src="../image/left.png" alt="" />
                            </div>
                        </template>
                        <template #title>
                            <div>AI助手<a @click="showChatTypePop()" class="header_title_llm">{{deepSeekItem.name}}</a><img @click="showChatTypePop()" class="header_llm_arrow" :src="showDeepSeekPop? './yr/images/arrow-up.png' : './yr/images/arrow-down.png'"></div>
                        </template>
                        <template #right>
                            <div class="btn_l_img active-brightness" @click="openHistory">
                                <img src="./yr/images/chat-history.png" alt="" />
                            </div>
                            <div class="btn_l_img active-brightness" @click="createChat">
                                <img src="./yr/images/new-chat.png" alt="" />
                            </div>
                        </template>
                    </van-nav-bar>
                    <div class="Navigation_l active-brightness" @click="closePlay()" style="z-index: 999;" v-if="isPlay">
                        <img src="../image/back.png" alt="" />
                    </div>
                    <video v-if="isPlay" id="videoPlayer" controls :src="videoSrc" autoplay></video>
                </div>
                <div class="main-container">
                    <div ref="scrollDiv" class="chat-main">
                        <div v-if="0 == chatRecords.length" class="chat-notice anima" :key="nowTime">
                            <div class="notice-header">
                                <div class="notice-header-left">
                                    <div class="notice-header-left1">
                                        <span>Hi 我是AI助手！</span>
                                    </div>
                                    <div class="notice-header-left2">
                                        <span>能写会画，有问必答，拥有丰富的智能体，打造智慧办公个人助手~~</span>
                                        <!-- <span class="notice-header-play"><img src="../image/tutorial.png" @click="openPlay()"/></span> -->

                                    </div>
                                </div>
                                <div class="notice-header-right">
                                    <img src="./yr/images/chat-root.png" />
                                </div>
                            </div>
                            <div class="notice-contents">
                                <div v-for="(item, index) in noticeList" :key="index" @click="handleNoticeClick(item)"
                                    class="notice-content active-brightness">
                                    <div class="notice-img-d">
                                        <img class="notice-img" :src="item.icon" />
                                    </div>
                                    <span class="content-item">{{ item.content }}</span>
                                    <van-icon name="arrow" />
                                </div>
                            </div>
                        </div>
                        <div class="chat-contents">
                            <div v-for="(item, index) in chatRecords" :key="index" class="chat-content">
                                <div class="chat-q" v-if="0 == item.type">
                                    <div class="chat-q-1">
                                        <van-popover v-model="item.showCopyPop" placement="bottom-start" theme="dark">
                                            <div :id="'cpq_' + item.id" class="copyBtn" @click="mycopy(item, 'cpq_' + item.id)">
                                                <van-button color="#4a4a4a" type="default">复制</van-button>
                                            </div>
                                            <template #reference>
                                                <div class="chat-q-content" v-html="item.contentHtml"
                                                    @touchstart="handleTouchStart($event, item, 'cpq_' + item.id)"
                                                    @touchend="handleTouchEnd($event, item, 'cpq_' + item.id)"
                                                >
                                                </div>
                                            </template>
                                        </van-popover>
                                    </div>
                                    <div class="chat-f active-brightness" v-if="item.qfiles && item.qfiles.length == 1 && 'IMG'!=item.qfiles[0].type.toUpperCase()" @click="preview(item.qfiles[0])">
                                        <div class="chat-f-l">
                                            <img v-if="'WORD'==item.qfiles[0].type.toUpperCase()" src="./yr/images/word.png" alt="" />
                                            <img v-if="'IMG'==item.qfiles[0].type.toUpperCase()" src="./yr/images/img.png" alt="" />
                                            <img v-if="'VOICE'==item.qfiles[0].type.toUpperCase()" src="./yr/images/voice.png" alt="" />
                                            <img v-if="'PDF'==item.qfiles[0].type.toUpperCase()" src="./yr/images/pdf.png" alt="" />
                                            <img v-if="'OFD'==item.qfiles[0].type.toUpperCase()" src="./yr/images/ofd.png" alt="" />
                                            <img v-if="'PPT'==item.qfiles[0].type.toUpperCase()" src="./yr/images/ppt.png" alt="" />
                                        </div>
                                        <div class="chat-f-r">
                                            <div class="chat-f-r1">{{ item.qfiles[0].name }}</div>
                                            <div class="chat-f-r2">
                                                <span class="chat-f-r2-f">
                                                    {{ item.qfiles[0].type.toUpperCase() }}
                                                </span>
                                                <span class="chat-f-r2-s">
                                                    {{ item.qfiles[0].fileSize }}
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                    <div v-if="item.qfiles && item.qfiles.length == 1 && 'IMG'==item.qfiles[0].type.toUpperCase()" class="has-img-file div-right">
                                        <div v-for="qfile in item.qfiles" :key="qfile.id" class="img-item">
                                            <div v-if="'IMG'==qfile.type" class="img-card">
                                                <img class="img" :src="qfile.imgSrc" />
                                            </div>
                                        </div>
                                    </div>
                                    <div v-if="item.qfiles && item.qfiles.length > 1 && !item.qfiles[0].imgSrc" class="has-file">
                                        <div v-for="qfile in item.qfiles" :key="qfile.id" class="item">
                                            <div v-if="'IMG'!=qfile.type" class="row">
                                                <div class="imgDiv">
                                                    <img class="img" :src="'./yr/images/'+qfile.type.toLowerCase()+'.png'" />
                                                </div>
                                                <div>
                                                    <div class="title file-title">{{ qfile.name }}</div>
                                                    <div class="desc">{{ qfile.type }}<span
                                                        style="margin: 0 0.1rem 0 0.1rem;"></span>{{qfile.fileSize}}</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div v-if="item.qfiles && item.qfiles.length > 1 && item.qfiles[0].imgSrc" class="has-img-file div-fit">
                                        <div v-for="qfile in item.qfiles" :key="qfile.id" class="img-item">
                                            <div v-if="'IMG'==qfile.type" class="img-card">
                                                <img class="img" :src="qfile.imgSrc" />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="chat-a" v-if="1 == item.type">
                                    <div class="chat-a-robot">
                                        <img v-if="'ALI' == item.modelType || 'BAIDU' == item.modelType || 'multiModel' == item.modelType" src="./yr/images/chat-a-robot.png" alt="" />
                                        <img v-else src="./yr/images/chat-ds-robot.png" alt="" />
                                        <div v-if="item.thinkContents" class="chat-a-thinking" @click="handleChangeThinkShow(item)">
                                            <span style="margin-right: 5px;" v-if="item.thinkEnd">已深度思考</span>
                                            <!-- <span style="margin-right: 5px;" v-if="item.thinkCost">已深度思考（用时 {{item.thinkCost || 1}} 秒）</span> -->
                                            <span style="margin-right: 5px;" v-else>思考中...</span>
                                            <van-icon v-if="item.thinkShow" name="arrow-up" />
                                            <van-icon v-else name="arrow-down" />
                                        </div>
                                    </div>
                                    <div class="chat-think-content" v-if="item.thinkShow && item.thinkContents && 0 < item.thinkContents.length">
                                        <van-popover :id="'copyPop_' + item.id" v-model="item.showCopyPop" theme="dark"
                                            :offset="[9999,8]" @opened="handleCopyPopOpend(item)" placement="bottom">
                                            <div style="display:none;width: 60px;" :id="'cpq2_' + item.id" class="copyBtn" @click="mycopy(item, 'cpq2_' + item.id)">
                                                <van-button color="#4a4a4a" type="default">复制</van-button>
                                            </div>
                                            <template #reference>
                                                <p @touchstart="handleTouchStart($event, item, 'copyPop_' + item.id)"
                                                    @touchend="handleTouchEnd($event, item, 'copyPop_' + item.id)" 
                                                    v-for="thinkContent in item.thinkContents">{{thinkContent}}
                                                </p>
                                            </template>
                                        </van-popover>
                                    </div>
                                    <div class="chat-a-content" v-if="(0!=item.tripStatus || !item.questionAttach) && item.thinkEnd && (item.contentHtml || (item.file && item.file.id))">
                                        <van-popover :id="'copyPop2_' + item.id" v-model="item.showCopyPop2" theme="dark"
                                            :offset="[9999,8]" @opened="handleCopyPopOpend2(item)" placement="bottom">
                                            <div style="display:none;width: 60px;" :id="'cpq3_' + item.id" class="copyBtn" @click="mycopy(item, 'cpq3_' + item.id)">
                                                <van-button color="#4a4a4a" type="default">复制</van-button>
                                            </div>
                                            <template #reference>
                                                <div class="markdown-body" @touchstart="handleTouchStart2($event, item,'copyPop2_' + item.id)"
                                                @touchend="handleTouchEnd($event, item,'copyPop2_' + item.id)" v-html="item.contentHtml"></div>
                                            </template>
                                        </van-popover>
                                        
                                        <div class="chat-af active-brightness" v-if="item.file && item.file.id" @click="preview(item.file)">
                                            <div class="chat-f-l">
                                                <img v-if="'WORD'==item.file.type.toUpperCase()" src="./yr/images/word.png" alt="" />
                                                <img v-if="'IMG'==item.file.type.toUpperCase()" src="./yr/images/img.png" alt="" />
                                                <img v-if="'VOICE'==item.file.type.toUpperCase()" src="./yr/images/voice.png" alt="" />
                                                <img v-if="'PDF'==item.file.type.toUpperCase()" src="./yr/images/pdf.png" alt="" />
                                                <img v-if="'OFD'==item.file.type.toUpperCase()" src="./yr/images/ofd.png" alt="" />
                                                <img v-if="'PPT'==item.file.type.toUpperCase()" src="./yr/images/ppt.png" alt="" />
                                            </div>
                                            <div class="chat-f-r">
                                                <div class="chat-f-r1">{{ item.file.name }}</div>
                                                <div class="chat-f-r2">
                                                    <span class="chat-f-r2-f">
                                                        {{ item.file.type.toUpperCase() }}
                                                    </span>
                                                    <span class="chat-f-r2-s">
                                                        {{ item.file.fileSize }}
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                        <van-divider v-if="item.firstSource" class="chat-divider"
                                            :style="{margin: '16px 0 0 0',borderColor: 'rgb(191 196 201)'}"></van-divider>
                                        <div v-if="item.firstSource" class="source-row">
                                            <div class="source-label">来源:</div>
                                            <div class="source-first active-brightness" @click="handleMoreSource(item)">
                                                <span v-if="item.sourceList.length == 0" class="">{{item.firstSource}}</span>
                                                <span v-if="item.sourceList.length > 0" class="">{{'1.'+item.firstSource}}</span>
                                                <span v-if="item.sourceList.length > 0" class="source-more">+{{item.sourceList.length}}</span>
                                            </div>
                                        </div>
                                        <div class="source-row" v-if="item.showSourceMore" v-for="(sitem, index) in item.sourceList">
                                            <div class="source-label"></div>
                                            <div class="source-first active-brightness" @click="item.showSourceMore = !item.showSourceMore">
                                                <span class="">{{(index+2) +'.'+sitem.name}}</span>
                                                <van-icon style="margin-left: 0.2rem;" v-if="index == item.sourceList.length-1" name="arrow-up" />
                                            </div>
                                        </div>
                                        <van-divider v-if="item.showAudio" class="chat-divider"
                                            :style="{margin: '8px 0 0 0',borderColor: 'rgb(191 196 201)'}"></van-divider>
                                        <van-divider v-if="!item.showAudio" class="chat-divider"
                                            :style="{margin: '8px 0 0 0',borderColor: '#F6F7F9'}"></van-divider>
                                        <div class="chat-a-btn" v-if="item.showAudio">
                                            <div class="chat-a-btn-l">
                                                <div v-if="!item.tripId && index == chatRecords.length-1" class="chat-a-rechat active-brightness" @click="reChat(item)">
                                                    <img
                                                        src="./yr/images/refresh.png" alt="" />
                                                </div>
                                                <div v-if="!item.tripId && index == chatRecords.length-1" class="chat-a-rechat active-brightness" @click="handleFeedBack(item, '1')">
                                                    <img v-if="'1' != item.feedType" src="./yr/images/good.png" alt="" />
                                                    <img v-if="'1' == item.feedType" src="./yr/images/good-fill.png" alt="" />
                                                </div>
                                                <div v-if="!item.tripId && index == chatRecords.length-1" class="chat-a-rechat active-brightness" @click="handleFeedBack(item, '-1')">
                                                    <img v-if="'-1' != item.feedType" src="./yr/images/bad.png" alt="" />
                                                    <img v-if="'-1' == item.feedType" src="./yr/images/bad-fill.png" alt="" />
                                                </div>
                                                <div v-if="index == chatRecords.length-1" :id="'cpa_' + item.id" class="chat-a-rechat active-brightness" @click="mycopy(item, 'cpa_' + item.id)">
                                                    <img
                                                        src="./yr/images/copy.png" alt="" />
                                                </div>
                                                <div v-if="!item.isPlaying && item.showAudio && index == chatRecords.length-1" class="chat-a-rechat active-brightness" @click="clickFunc('play', item)" >
                                                    <img src="./yr/images/play-fill.png" alt="" />
                                                </div>
                                                <div v-if="item.isPlaying && item.showAudio && index == chatRecords.length-1" class="chat-a-rechat active-brightness" @click="clickFunc('pause', item)" >
                                                    <img src="./yr/images/suspend-fill.png" alt="" />
                                                </div>
                                            </div>
                                            <div class="chat-a-btn-r">
                                                <!-- <div v-if="!item.isPlaying" class="chat-a-email active-brightness" @click="clickFunc('play', item)" >
                                                    <img src="./yr/images/play-fill.png" alt="" />
                                                </div>
                                                <div v-if="item.isPlaying" class="chat-a-email active-brightness" @click="clickFunc('pause', item)" >
                                                    <img src="./yr/images/suspend-fill.png" alt="" />
                                                </div> -->
                                                <!-- <div class="chat-a-email active-brightness" @click="sendMyEmail(item)" >
                                                    <img src="./yr/images/send-email.png" alt="" />
                                                </div>
                                                <div class="chat-a-email active-brightness" @click="syncToInner(item)" >
                                                    <img src="./yr/images/sync.png" alt="" />
                                                </div>
                                                <div class="chat-a-share active-brightness" @click="shareIgw(item)">
                                                    <img src="./yr/images/share.png" alt="" />
                                                </div> -->
                                            </div>
                                        </div>
                                    </div>
                                    <div class="chat-a-content chat-a-trip-cards" v-if="0==item.tripStatus && item.questionAttach && item.trips && 0 < item.trips.length">
                                        <div class="chat-a-trip-header">
                                            <div class="trip-header-left">
                                                <div>{{item.content}}</div>
                                            </div>
                                        </div>
                                        <van-divider class="chat-divider"
                                            :style="{margin: '0.2rem 0px 0px',borderColor: 'rgb(191 196 201)'}"></van-divider>
                                        <div :class="['chat-a-trip-card', 'chat-a-trip-card-divider']" v-for="(trip, index) in item.trips">
                                            <div class="chat-table-card-contents">
                                                <div class="chat-a-card-row1">
                                                    <div class="table-trip-card-row">
                                                        <span class="table-trip-card-label">会议时间:</span><input :class="[item.editable?'table-trip-input-edit':'table-trip-input-unedit']" readonly
                                                            v-model="trip.tripTimeShow" @click="showTimePicker(item, trip, index)" />
                                                    </div>
                                                </div>
                                                <div class="chat-a-card-row1">
                                                    <div class="table-trip-card-row">
                                                        <span class="table-trip-card-label">会议地点:</span><input :class="[item.editable?'table-trip-input-edit':'table-trip-input-unedit']" 
                                                        :disabled="!item.editable" placeholder="" v-model="trip.location" />
                                                    </div>
                                                </div>
                                                <div class="chat-a-card-row1">
                                                    <div class="table-trip-card-row">
                                                        <span class="table-trip-card-label2">主办单位(部室):</span><input :class="[item.editable?'table-trip-input-edit':'table-trip-input-unedit2']" 
                                                        :disabled="!item.editable" placeholder="" v-model="trip.hostOrg" />
                                                    </div>
                                                </div>
                                                <div class="chat-a-card-row1">
                                                    <div class="table-trip-card-row">
                                                        <span class="table-trip-card-label">主要内容:</span><input :class="[item.editable?'table-trip-input-edit':'table-trip-input-unedit']" 
                                                        :disabled="!item.editable" placeholder="" v-model="trip.content" />
                                                    </div>
                                                </div>
                                                <div class="chat-a-card-row1">
                                                    <div class="table-trip-card-row">
                                                        <span class="table-trip-card-label">参会人员:</span><input :class="[item.editable?'table-trip-input-edit':'table-trip-input-unedit']" 
                                                        :disabled="!item.editable" placeholder="" v-model="trip.tripUser" />
                                                    </div>
                                                </div>
                                                <!-- <div class="chat-a-card-row2">
                                                    <span class="table-trip-card-label">会议地点:</span><input :class="[item.editable?'trip-input-edit':'trip-input-unedit']" :disabled="!item.editable" placeholder="" v-model="trip.content" />
                                                </div> -->
                                            </div>
                                        </div>
                                        <div class="chat-a-btn">
                                            <div class="chat-a-btn-l2">
                                                <div v-if="!item.editable"  class="chat-a-rechat active-brightness" @click="handleEditTrip(item)">
                                                    <img src="./yr/images/bj.png" alt="" />
                                                </div>
                                                <!-- <div v-if="item.editable" class="chat-a-rechat active-brightness" @click="handleCancelEditTrip(item)">
                                                    <van-icon name="revoke" />
                                                </div> -->
                                            </div>
                                            <div class="chat-a-btn-r">
                                                <div class="chat-trip-confirm active-brightness" @click="handleCreateTrip(item)" >
                                                    <span>确定</span>
                                                </div>
                                                <div v-if="item.editable" class="chat-trip-delete active-brightness" @click="handleCancelEditTrip(item)">
                                                    <span>取消</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="chat-a-content chat-a-trip-cards" v-if="(1==item.tripStatus||4==item.tripStatus) && item.trips && 0 < item.trips.length">
                                        <div class="chat-a-trip-header">
                                            <div class="trip-header-left">
                                                <div class="chat-trip-img"><img class="" src="./yr/images/chat-trip.png" /></div>
                                                <div class="chat-trip-title">日程提醒</div>
                                            </div>
                                            <div class="chat-trip-header-right"><van-icon v-if="item.tripStatus && 1 == item.tripStatus" name="ellipsis" @click="showAllTripPop" /></div>
                                        </div>
                                        <van-divider class="chat-divider"
                                            :style="{margin: '0.12rem 0px 0px',borderColor: 'rgb(191 196 201)'}"></van-divider>
                                        <div :class="['chat-a-trip-card', 'chat-a-trip-card-divider']" v-for="(trip, index) in item.trips">
                                            <div v-show="item.editable" class="trip-card-checkbox">
                                                <van-checkbox v-model="trip.check"></van-checkbox>
                                            </div>
                                            <div class="chat-a-card-contents">
                                                <div class="chat-a-card-row2 trip-card-content">
                                                    <input :class="[item.editable?'trip-input-edit':'trip-input-unedit']" :disabled="!item.editable" placeholder="" v-model="trip.content" />
                                                </div>
                                                <div class="chat-a-card-row1">
                                                    <div class="trip-card-user">
                                                    {{trip.tripUser}}
                                                    </div>
                                                    <div class="trip-card-time">
                                                        <input :class="[item.editable?'trip-input-edit':'trip-input-unedit']" readonly
                                                            v-model="trip.tripTimeShow" @click="showTimePicker(item, trip, index)" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div v-if="!item.editable && item.tripStatus && 1 == item.tripStatus" class="chat-a-card-switch" @click="handleSetRemindTime(trip, index)">
                                                <img src="./yr/images/clock.png" alt="" />
                                            </div>
                                        </div>
                                        <div v-if="item.tripStatus && 1 == item.tripStatus" class="chat-a-btn">
                                            <div class="chat-a-btn-l2">
                                                <div v-if="!item.editable"  class="chat-a-rechat active-brightness" @click="handleEditTrip(item)">
                                                    <img src="./yr/images/bj.png" alt="" />
                                                </div>
                                                <div v-if="item.editable" class="chat-a-rechat active-brightness" @click="handleCancelEditTrip(item)">
                                                    <!-- <van-icon style="font-size: 22px;" name="revoke" /> -->
                                                    <img src="./yr/images/revoke.png" alt="" />
                                                </div>
                                            </div>
                                            <div class="chat-a-btn-r">
                                                <!-- <div v-if="!item.editable" class="chat-a-email active-brightness" @click="sendTripEmail(item)" >
                                                    <img src="./yr/images/send-email.png" alt="" />
                                                </div>
                                                <div v-if="!item.editable" class="chat-a-email active-brightness" @click="syncTripToInner(item)" >
                                                    <img src="./yr/images/sync.png" alt="" />
                                                </div>
                                                <div v-if="!item.editable" class="chat-a-share active-brightness" @click="shareTripIgw(item)">
                                                    <img src="./yr/images/share.png" alt="" />
                                                </div> -->
                                                <div v-if="item.editable" class="chat-trip-confirm active-brightness" @click="handleUpdateTrip(item)" >
                                                    <span>确定</span>
                                                </div>
                                                <div v-if="item.editable" class="chat-trip-delete active-brightness" @click="handleTripDelete(item)">
                                                    <span>删除</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="chat-a-content chat-a-content-msg" v-if="item.tripErrMsg">
                                        <div class="markdown-body" v-html="showErrMsg(item.tripErrMsg)"></div>
                                        <van-divider v-if="item.tripStatus && 4 == item.tripStatus" class="chat-divider"
                                            :style="{margin: '8px 0 0 0',borderColor: 'rgb(191 196 201)'}"></van-divider>
                                        <div v-if="item.tripStatus && 4 == item.tripStatus" class="trip-err-btn">
                                            <div class="trip-btn-add" @click="handleAddTrip(item)">添加</div>
                                            <div class="trip-btn-del" @click="handleCancelTrip(item)">取消</div>
                                        </div>
                                    </div>
                                    <div class="chatting" v-if="!item.thinkEnd || (!item.content && chatting)">
                                        <div class="chatting-a-content">
                                            <img class="chat-loading" src="./yr/images/chat-loading.gif" alt="" />
                                        </div>
                                        <a v-if="item.questionType!=4" class="chatting-tip">正在思考中</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="bottom">
                        <div class="quick-btn" v-if="showFile && uploadWord && !showImg">
                            <div v-if="showUploadBtn() && uploadFileList[0].type == 'WORD'" :class="['spanBackGround active-brightness', uploadIntent==1?'upload-sel-intent':'']"
                                @click="handleUploadIntentClick(1)">
                                <!-- <span>WORD转PDF</span> -->
                                <div class="split-area" style="width: 100%;">
                                    <span>WORD转PDF</span>
                                    <!-- <span class="split-txt" v-for="textItem in ('WORD转PDF').split('')">{{ textItem }}</span> -->
                                </div>
                            </div>
                            <!-- <div v-if="uploadFileList.length == 1" :class="['spanBackGround', uploadIntent==2?'upload-sel-intent':'']" style="margin-left: 5px;"
                                @click="handleUploadIntentClick(2)">
                                    <span>WORD转OFD</span>
                            </div> -->
                            <div :class="['spanBackGround active-brightness', uploadIntent==3?'upload-sel-intent':'']" style="margin-left: 5px;"
                                @click="handleUploadIntentClick(3)">
                                    <!-- <span>文档总结</span> -->
                                    <div class="split-area" style="width: 100%;">
                                        <span>文档总结</span>
                                        <!-- <span class="split-txt" v-for="textItem in ('文档总结').split('')">{{ textItem }}</span> -->
                                    </div>
                            </div>
                        </div>
                        <div class="search-tip">
                            <div v-if="showFile && !showImg" :class="uploadFileList.length == 0 ? 'hasnt-file' : 'has-file'" ref="uploadFileRef">
                                <div v-for="item in uploadFileList" :key="item.id" class="item">
                                    <div class="row">
                                        <div class="imgDiv">
                                            <img class="img" :src="'./yr/images/'+item.type.toLowerCase()+'.png'" />
                                        </div>
                                        <div>
                                            <div class="tip-close active-brightness" @click="delFile(item)">
                                                <img class="tip-close-img" src="./yr/images/close.png" alt="" />
                                            </div>
                                            <div class="title file-title">{{ item.name }}</div>
                                            <div class="desc">{{ item.type }}<span
                                                    style="margin: 0 0.1rem 0 0.1rem;"></span>{{item.fileSize}}</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="search-tip">
                            <div v-if="showFile && showImg" class="has-img-file">
                                <div v-for="item in uploadFileList" :key="item.id" class="img-item">
                                    <div class="img-card">
                                        <img class="img" :src="item.imgSrc" />
                                    </div>
                                    <div @click="delFile(item)" class="van-uploader__preview-delete"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i></div>
                                </div>
                            </div>
                        </div>
                       
                        <div class="quick-btn" v-if="(showImg || buttonShow) && !showTripTool">
                            <!-- <div :class="['spanBackGround active-brightness', questionType==4?'quick-sel-ds':'']" @click="handleQuestionTypeClick(4)">
                                <div>
                                    <img class="quick-btn-img" :src="[deepSeekItem && deepSeekItem.icon? deepSeekItem.icon:'./yr/images/quick-chat-com.png']" />
                                </div>
                                <div class="split-area">
                                    <span class="split-txt" v-for="textItem in (deepSeekItem.name || '通用对话').split('')">{{ textItem }}</span>
                                </div>
                            </div> -->
                            <!-- <div v-if="!showImg" :class="['spanBackGround active-brightness', questionType==2?'quick-sel-hot':'']" @click="handleQuestionTypeClick(2)">
                                <div>
                                    <img class="quick-btn-img" :src="[questionType==2?'./yr/images/chat-hot-sel.png':'./yr/images/chat-hot.png']" />
                                </div>
                                <div class="split-area">
                                    <span>联网搜索</span>
                                </div>
                            </div>
                            <van-popover v-model="showMajorPopover" placement="top" @opened="handleMajorOpen" @closed="handleMajorClosed">
                                <div class="major-row">
                                    <div :class="['major-item']" v-for="item in majors" @click="handleSelectMajor(item)">
                                        <div :class="['major-btn', item.using ? 'major-active' : 'major-unactive',
                                        item.using && item.typeCode==currentMajor.typeCode ? 'major-btn-selected':'']">{{item.typeName}}</div>
                                    </div>
                                </div>
                                <template #reference>
                                    <div v-if="!showImg" :class="['spanBackGround active-brightness', questionType==3?'quick-sel-el':'']" style="margin-left: 5px;"
                                        @click="handleQuestionTypeClick(3)">
                                        <div>
                                            <img class="quick-btn-img" :src="[questionType==3?'./yr/images/chat-el-sel.png':'./yr/images/chat-el.png']" />
                                        </div>
                                        <div class="split-area">
                                            <span>{{currentMajor.typeName || '专业问答'}}</span>
                                        </div>
                                    </div>
                                </template>
                            </van-popover> -->
                            <div id="12-tripResPer" v-if="haveTripPermission()" :class="['spanBackGround active-brightness', questionType==5?'quick-sel-trip':'']" style="margin-left: 5px;" @click="handleQuestionTypeClick(5)">
                                <div>
                                    <img class="quick-btn-img" :src="[questionType==5?'./yr/images/trip-sel.png':'./yr/images/trip.png']" />
                                </div>
                                <div class="split-area">
                                    <span>日程提醒</span>
                                    <!-- <span class="split-txt" v-for="textItem in ('日程提醒').split('')">{{ textItem }}</span> -->
                                </div>
                            </div>
                        </div>

                        <div v-if="isPressing" :class="['voice-tip', movingUp ? 'voice-tip-cancel' : 'voice-tip-normal']">
                            {{buttonText}}
                        </div>
                        <div v-if="showTripTool">
                            <div class="trip-tool">
                                <div class="trip-tool-container">
                                    <div class="trip-tool-header">
                                        <div class="chat-trip-img"><img src="./yr/images/trip2.png"></div>
                                        <div class="trip-tool-title">日程提醒</div>
                                        <div class="trip-tool-close" @click="handleCloseTripTool()"><img src="./yr/images/trip-tool-close.png" alt="" /></div>
                                    </div>
                                    <div class="trip-tool-items">
                                        <div style="display:flex;">
                                            <div class="trip-tool-item" @click="handleAllTripChat()">查看全部提醒</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- 提问框 -->
                            <div class="search search-trip">
                                <div class="search-img-div active-brightness" @click="toggleVoiceKeybord" v-if="!isPressing">
                                    <!-- <img class="voice-img" src="./yr/images/voice-play.png" /> -->
                                    <img v-if="voicing" class="voice-img" src="./yr/images/keyboard.png" />
                                    <img v-if="!voicing" style="width: 0.4rem;" class="voice-img" src="./yr/images/voice-play.png" />
                                </div>
                                <input v-if="!voicing" id="voiceInput" :readonly="voicing" :class="['search-text', showUploadBtn() ? 'search-wd' : 'search-wd2']" :placeholder="inputPlaceholder"
                                    v-model="searchText">
                                <div v-if="voicing" :class="['press-text', isPressing ? (movingUp ? 'press-wd2 press-cancel' : 'press-wd2 press-normal') : 'search-wd']"
                                    @touchstart="handleVoiceTouchStart"
                                    @touchend="handleVoiceTouchEnd"
                                    @touchmove="handleVoiceTouchMove">
                                    <span v-if="isPressing"></span>
                                    <span v-if="!isPressing">按住说话</span>
                                </div>
                                <div v-if="showUploadBtn()" class="search-img-div active-brightness" @click="chooseUpload()">
                                    <img class="upload-img" src="./yr/images/upload.png"  />
                                </div>
                                <div class="search-img-div active-brightness" @click="stopChat" v-if="chatting&&!isPressing">
                                    <img class="send-img" src="./yr/images/chat-stop.png" />
                                </div>
                                <div class="search-img-div active-brightness" @click="handleSend()" v-if="searchText && !chatting&&!isPressing">
                                    <img class="send-img" src="./yr/images/send.png" />
                                </div>
                                <div class="search-img-div active-brightness" @click="handleSend()" v-if="!searchText && !chatting&&!isPressing" >
                                    <img class="send-img" src="./yr/images/no-send.png"/>
                                </div>
                            </div>
                        </div>

                        <!-- 提问框 -->
                        <div class="search search-normal" v-if="!showTripTool">
                            <div class="search-img-div active-brightness" @click="toggleVoiceKeybord" v-if="!isPressing">
                                <img v-if="voicing" class="voice-img" src="./yr/images/keyboard.png" />
                                <img v-if="!voicing" style="width: 0.4rem;" class="voice-img" src="./yr/images/voice-play.png" />
                            </div>
                            <input v-if="!voicing" id="voiceInput" :readonly="voicing" :class="['search-text', showUploadBtn() ? 'search-wd' : 'search-wd2']" :placeholder="inputPlaceholder"
                                v-model="searchText">
                            <div v-if="voicing" :class="['press-text', isPressing ? (movingUp ? 'press-wd press-cancel' : 'press-wd press-normal') : 'search-wd']"
                                @touchstart="handleVoiceTouchStart"
                                @touchend="handleVoiceTouchEnd"
                                @touchmove="handleVoiceTouchMove">
                                <span v-if="isPressing"></span>
                                <span v-if="!isPressing">按住说话</span>
                            </div>
                            <div v-if="showUploadBtn()" class="search-img-div active-brightness" @click="chooseUpload()">
                                <img class="upload-img" src="./yr/images/upload.png"  />
                            </div>
                            <div class="search-img-div active-brightness" @click="stopChat" v-if="chatting&&!isPressing">
                                <img class="send-img" src="./yr/images/chat-stop.png" />
                            </div>
                            <div class="search-img-div active-brightness" @click="handleSend()" v-if="searchText && !chatting &&!isPressing">
                                <img class="send-img" src="./yr/images/send.png" />
                            </div>
                            <div class="search-img-div active-brightness" @click="handleSend()" v-if="!searchText && !chatting &&!isPressing" >
                                <img class="send-img" src="./yr/images/no-send.png"/>
                            </div>
                        </div>
                        <!-- 录音 -->
                        <!-- <div class="voice" v-if="voicing">
                            <div class="voice-t">
                                <img src="./yr/images/waf.gif" />
                            </div>
                            <div class="voice-b">
                                <van-button class="voice-btn" type="info" @click="endVoice()">说完了</van-button>
                            </div>
                        </div> -->
                    </div>
                </div>


                <div class="musicPlay">
                    <audio ref="audio" id="course-aud" @play="playFunc" @pause="pauseFunc" @ended="endedFunc" preload="auto"
                        :src="audioSrc">
                    </audio>
                </div>

            <van-action-sheet v-model:show="showTimeFlag" :key="pickerKey">
                <van-datetime-picker
                    v-model="selDate"
                    type="datetime"
                    title="选择行程时间"
                    :min-date="minDate"
                    :max-date="maxDate"
                    @confirm="confirmDate()"
                    @cancel ="cancelDate()"
                    />
             </van-action-sheet>

             <!-- 设置行程提醒时间 -->
             <van-popup v-model="showRemindTimePop" position="left" :style="{ width: '100%',height: '100%' }">
                <div class="trip-remind-time-pop">
                    <van-nav-bar title="提醒" :border=false left-arrow>
                        <template #left>
                            <div class="back_l" @click="closeRemindTimePop()">
                                <img src="../image/left.png" alt="" />
                            </div>
                        </template>
                        <template #right>
                        </template>
                    </van-nav-bar>
                    <div class="trip-remind-time-list">
                        <div class="remind-time-row1">
                            <div class="row-child-left">提醒</div>
                            <div><van-switch v-model="remindTimeCheck" @change="handleChangeRemindStatus" size="24px" /></div>
                        </div>
                        <div class="remind-time-row2">
                            <van-checkbox-group class="remind-time-group" v-model="remindTimes">
                                <div :class="['remind-time-list', index < remindTimeList.length-1 ? 'remind-time-list-first': '']" v-for="(item, index) in remindTimeList" @click="toggleRemind(index, item)">
                                    <div class="remind-time-main">
                                        <!-- <div class="van-cell__value van-cell__value--alone van-contact-card__value"> -->
                                            <div>{{item.name}}</div>
                                        <!-- </div> -->
                                    </div>
                                    <div class="card-checkbox">
                                        <van-checkbox :name="item" :disabled="item.disabled" icon-size="16px" shape="square" ref="remindTimeCb" />
                                    </div>
                                </div>
                            </van-checkbox-group>
                        </div>
                    </div>
                </div> 
            </van-popup>

            <!-- 全部行程 -->
            <van-popup v-model="tripListPop" position="left" :style="{ width: '100%',height: '100%' }">
                <div class="trip-list-pop">
                    <van-nav-bar title="全部行程" :border=false left-arrow>
                        <template #left>
                            <div class="back_l" @click="closeTripListPop">
                                <img src="../image/left.png" alt="" />
                            </div>
                        </template>
                        <template #right>
                            <div v-if="!multiChoose" class="select-all-btn active-brightness" @click="handleMultiChooseClick">
                                多选
                            </div>
                            <div v-if="multiChoose" class="select-all-btn active-brightness" @click="handleMultiChooseShow">
                                取消
                            </div>
                        </template>
                    </van-nav-bar>
                    <!-- <div class="trip-remind-time-list"> -->
                        <div :class="['trip-list-main', multiChoose ? 'main-short' : 'main-all']">
                            <div class="trip-empty-main" v-if="!allTrips || 0 == allTrips.length">
                                <div class="trip-empty-bg"></div>
                                <div class="trip-empty-content">你可以跟我设置要提醒的人员、事件与时间！</div>
                            </div>
                            <div v-else v-for="(groupTrips, index) in allTrips">
                                <h2 class="trip-time">
                                    {{groupTrips[0].groupTime}}
                                </h2>
                                <!-- <van-divider class="chat-divider"
                                    :style="{margin: '0.2rem 0px 0px',borderColor: 'rgb(191 196 201)'}"></van-divider> -->
                                <van-checkbox-group class="trip-list-card-group" v-model="checkTripList">
                                    <div :class="['all-trip-card', index2 < groupTrips.length-1 ? 'all-trip-card-divider': '']" v-for="(trip, index2) in groupTrips" @click="toggleTrip(trip)">
                                        <div class="all-trip-card-contents">
                                            <div class="all-trip-card-row2">
                                                <div :class="['trip-input-unedit']" >{{trip.content}}</div>
                                            </div>
                                            <div class="all-trip-card-row1">
                                                <div class="all-trip-card-user">
                                                {{trip.tripUser}}
                                                </div>
                                                <div class="all-trip-card-time">
                                                    <div class="all-trip-input-unedit trip-input-unedit">{{trip.tripTime}}</div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="all-trip-card-switch" v-if="multiChoose">
                                            <van-checkbox :name="trip" ref="checkboxes" />
                                        </div>
                                        <div class="all-trip-card-switch" v-else @click="handleSetRemindTime(trip, index)">
                                            <img src="./yr/images/clock.png" alt="" />
                                        </div>
                                    </div>
                                </van-checkbox-group>
                            </div>
                        </div>
                        <div class="all-trip-bottom" v-if="multiChoose">
                            <div class="all-trip-bottom-left">
                                <van-checkbox class="all-trip-checkbox" v-model="chooseAll" 
                                @click="chooseTripAllClick" icon-size="24px">全选</van-checkbox>
                            </div>
                            <div class="all-trip-bottom-right">
                                <van-button type="danger" size="small" @click="handlePopTripDelete">删除</van-button>
                            </div>
                        </div>
                    <!-- </div> -->
                </div> 
            </van-popup>

                <van-popup v-model="feedBackPopShow" position="bottom" round closeable @close="closeFeedBackPop">
                    <div class="feedback-main">
                        <div class="feedback-title">
                            信息反馈
                        </div>
                        <div class="feedback-type">
                            <div :class="['feedback-type-item', feedBackSel.includes(item.value) ? 'feedback-type-select' : '']"
                                v-for="item in feedBackTypeList" @click="handleFeedBackSelect(item)">
                                {{ item.name }}
                            </div>
                        </div>
                        <div class="feedback-input">
                            <textarea rows="4" class="area-input" placeholder="修正答案" v-model="feedSuggestion"></textarea>
                        </div>
                        <div class="feedback-btn">
                            <van-button color="#3d6eee" block @click="submitFeedBack">提交</van-button>
                        </div>
                    </div>
                </van-popup>

                <van-popup v-model="showHistory" round position="left" :style="{ width: '85%',height: '100%' }">
                    <div>
                        <van-nav-bar title="AI助手" :border=false left-arrow>
                            <template #left>
                                <div class="back_l" @click="backIndex">
                                    <img src="../image/left.png" alt="" />
                                </div>
                            </template>
                            <template #right>
                                <div class="btn_l_img active-brightness" @click="deleteAllHistory">
                                    <img src="./yr/images/qk.png" alt="" />
                                </div>
                                <div class="btn_l_img active-brightness" @click="createChat">
                                    <img src="./yr/images/new-chat.png" alt="" />
                                </div>
                            </template>
                        </van-nav-bar>

                        <van-row :class="['search-row', isSearchFocused ? 'no-bottom' : '']">
                            <div class="search-item-in active-brightness" @click="searchShow()" v-if="!showSearch">
                                <a class="search-a">近一个月历史对话</a>
                                <!-- <input class="search-input" @keyup.enter="onSearch()" v-model="searchParams" placeholder="请输入搜索关键词"  v-if="showSearch" clearable @blur="showOrHide()"></input> -->
                                <img class="search-btn" src="./yr/images/write/search-btn.png" @click="searchShow()"/>
                            </div>
                            <div v-if="showSearch" style="line-height: 1rem;">
                                <van-icon name="search" class="search-btn-l"></van-icon>
                                <input v-if="showSearch" class="search-input" @keyup.enter="onSearch()" v-model="searchParams" placeholder="请输入..."/>
                                <span @click="onCancel" class="search-cancle active-brightness">取消</span>
                            </div>
                        </van-row>

                        <div v-if="isSearchFocused" class="sstc">
                            <div class="searchBackGroud">
                            </div>
                        </div>
                        <div class="List" v-show="!isSearchFocused">
                            <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="loadHistoryData">
                                <van-swipe-cell v-for="(item,index) in historyList" :key="index">
                                    <van-cell :label="item.createTime" @click="openHistoryRecord(item.id)">
                                        <template #title>
                                            <span style="font-weight: bold;">{{item.chatTitle}}</span>
                                        </template>
                                    </van-cell>
                                    <template #right>
                                        <van-button class="delete-button" @click="delHistory(item.id)" icon="delete-o"
                                            square text="删除" type="danger" />
                                    </template>
                                </van-swipe-cell>
                            </van-list>
                        </div>
                    </div>
                </van-popup>
            </div>
        </div>
    </script>
    <div id="app" v-cloak>
        <div class="_igw_capsule_className"></div>
        <div class="is-loading">
            <div class="curtain">
                <div class="loadingBgc">
                    <div class="loader"></div>
                </div>
            </div>
        </div>
        <div class="diolpop">
            <van-popup class="van_pop" round v-cloak :close-on-click-overlay="false" v-model="showShare">
                <div :style="{ backgroundImage: tabBackground }" class="pop_content">

                    <div class="pop_content_tabs">
                        <van-tabs nav-height="60px" type="card" @click="onchange">
                            <template v-for="item in tabData">
                                <van-tab :title-style="{background:getTabColor(item.messageType)}"
                                    :title="getTabTitle(item.messageType)">
                                    <div class="pop_content_tabs_item">
                                        <div class="pop_content_tabs_item_title">
                                            {{item.title}}
                                        </div>
                                        <div class="pop_content_tabs_item_content" v-html=item.messageContent></div>
                                    </div>
                                </van-tab>
                            </template>
                        </van-tabs>

                    </div>
                    <div class="bottom_del">
                        <div @click="delBtn" class="bottom_del_btn"><img src="../image/closeBtn.png" alt=""></div>
                    </div>
                </div>

            </van-popup>
        </div>
        <div id="home_wrapper">
            <div class="home_box" :style="activeBoxStyle" v-show="shouldShowComponent(active)">
                <component :is="currentComponent" v-bind="getComponentProps"></component>
            </div>
            <div class="home_tab">
                <van-tabs v-model="active" @change="changeAct">
                    <van-tab v-for="(item,index) in homeTab">
                        <div slot="title" class="slot_title">
                            <template v-if='item.num == 2'>
                                <van-icon :dot="wodePageData.dot"> <img :src="index == active ? item.imgAct: item.img"
                                        alt=""></van-icon>

                                {{item.name}}
                            </template>

                            <template v-else>
                                <img :src="index == active ? item.imgAct: item.img" alt="">
                                {{item.name}}
                            </template>
                        </div>
                    </van-tab>
                </van-tabs>
            </div>
        </div>
    </div>

    <script>
        new Vue({
            el: "#app",
            data() {

                return {
                    tabActive: '',
                    tabData: [
                        {
                            "delTime": null,
                            "endTime": "2026-12-31 23:59:59",
                            "id": "422da04603bb4aff8f5a225118872d24",
                            "messageContent": "测试内容2",
                            "messageCreateTime": "2025-09-01 10:00:00",
                            "messageId": "15",
                            "messageType": 2,
                            "readStatus": 0,
                            "readTime": null,
                            "startTime": "2025-09-01 10:00:00",
                            "title": "测试2",
                            "userId": "testuserid1"
                        },
                        {
                            "delTime": null,
                            "endTime": "2026-12-31 23:59:59",
                            "id": "1264269125f44547a9cad8ecb6e2cadf",
                            "messageContent": "测试内容2",
                            "messageCreateTime": "2025-09-01 10:00:00",
                            "messageId": "3",
                            "messageType": 3,
                            "readStatus": 0,
                            "readTime": null,
                            "startTime": "2025-09-01 10:00:00",
                            "title": "测试3",
                            "userId": "testuserid1"
                        },
                        {
                            "delTime": null,
                            "endTime": "2026-12-31 23:59:59",
                            "id": "14019332463443a18811371602e2d5ae",
                            "messageContent": "<p>亲爱的各位同事</p><p><span>&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;</span>测试数据，巴拉巴拉巴拉巴拉未发现哦v噢批货物联合国v哦额我怕哈利！</p><p style=\"text-align:right;\">天天项目组</p><p style=\"text-align:right;\">2025年9月11日</p><a href=\"./yr/message/index.html\">跳转</a>",
                            "messageCreateTime": "2025-09-01 10:00:00",
                            "messageId": "1",
                            "messageType": 1,
                            "readStatus": 0,
                            "readTime": null,
                            "startTime": "2025-09-01 10:00:00",
                            "title": "测试",
                            "userId": "testuserid1"
                        }
                    ],
                    showShare: false, //弹框
                    active: sessionStorage.getItem("activeNum") ? Number(sessionStorage.getItem(
                        "activeNum")) : 0,
                    homeTab: [{
                        img: '../image/dh.png',
                        imgAct: '../image/dh1.png',
                        name: "对话",
                        num: 0,
                    }, {
                        img: '../image/znt.png',
                        imgAct: '../image/znt1.png',
                        name: "智能应用",
                        num: 1
                    }, {
                        img: '../image/wd.png',
                        imgAct: '../image/wd1.png',
                        name: "我的",
                        num: 2
                    }, ],
                    // 定义要传递给 wode-page 组件的值
                    wodePageData: {
                        dot: false,
                    }

                }
            },
            watch: {},
            computed: {
                // 动态组件
                tabBackground() {
                    const com = {
                        2: "url(../image/jxtk.png)",
                        3: "url(../image/bbtk.png)",
                        1: "url(../image/xttk.png)"
                    }
                    return com[this.tabActive]
                },
                getTabTitle() {
                    return (messageType) => {
                        switch (messageType) {
                            case 1:
                                return '系统消息';
                            case 2:
                                return '检修公告';
                            case 3:
                                return '版本更新';
                        }
                    }
                },
                getTabColor() {
                    return (color) => {
                        switch (color) {
                            case 1:
                                return '#8387dc';
                            case 2:
                                return '#ea5b53';
                            case 3:
                                return '#3d6eee';
                        }
                    }
                },
                // 动态组件
                currentComponent() {
                    const components = {
                        0: 'dialogue-page',
                        1: 'home-page',
                        2: 'wode-page'
                    }
                    return components[this.active] || 'dialogue-page'
                },
                // 动态计算背景色
                activeBoxStyle() {
                    return {
                        backgroundColor: this.active === 1 ? '#f7faff' : '#f6f7f9',
                        // 可以继续添加其他需要动态控制的样式
                    }
                },
                // 根据当前组件返回要传递的属性
                getComponentProps() {
                    if (this.currentComponent === 'wode-page') {
                        return false
                        // return this.wodePageData; // 我的跟消息通知去掉小红点（已读和未读提示）
                    }
                    return {};
                }

            },
            created() {
                const _this = this
                let jsApiList = []
                $.getScript("../js/jweixin-sgccigw-1.0.0.js" /*"js/jweixin-1.0.0.js"*/ , function () {
                    'use strict';
                    wx.ready(function () {
                        wx.onHistoryBack(() => {
                            _this.close()
                            return false
                        })
                        // CAPSULE.show();
                    });
                    jsApiList = [
                        "setFloatWindow",
                        "openChatWithMsg",
                        "shareAppMessage",
                        'ext_FileBrowser_ChooseDir',

                        "getZipAppDirectory", //获取h5包路径
                        "multiWindows_startWidget", //打开应用 2.0
                        "multiWindows_open", //打开窗口 2.0
                        'ext_FileManager_AppList', //获取应用缓存
                        'ext_Intent_Dial', //打电话
                        'getLocation',
                        'closeWindow',
                        'startRecord',
                        "previewFile",
                        'stopRecord',
                        'onVoiceRecordEnd',
                        'translateVoice',
                        'onHistoryBack',
                    ];
                    wx.config({
                        beta: true,
                        debug: false,
                        appId: corpid,
                        timestamp: '1626832073',
                        nonceStr: nonceStr,
                        signature: signature,
                        jsApiList: jsApiList
                    });
                });

            },
            mounted() {
                this.$nextTick(() => {
                    this.getUserMessage()
                    // getUserMessage((Read) => {
                    //     this.wodePageData.dot = !Read
                    //     console.log(this.wodePageData, 888);
                    //     // 在这里可以根据 Read 的值进行相应的操作
                    // });
                })
            },
            methods: {
                // 关闭弹框函数
                delBtn() {
                    // 调用已读接口
                    this.readMessage("1,2,3")
                    this.showShare = false
                },
                readMessage(messageType) {
                    console.log(messageType)
                    const userId = sessionStorage.getItem("userId");
                    let param = {
                        "userId": userId,
                        "messageType": messageType,
                        "timestamp": new Date().getTime() + "",
                    };
                    let AuthenticationSession = sessionStorage.getItem("Authentication");
                    data = JSON.stringify(param)
                    let sign = sm3(data);
                    $.ajax({
                        url: localUrlLink + iscp_port + "/tjAiAssistant/userMessage/readMessage",
                        type: "post",
                        // async: false, //是否同步，false表示同步请求
                        dataType: "json",
                        data: data,
                        headers: {
                            "Content-Type": "application/json;charset=UTF-8",
                            Authentication: AuthenticationSession,
                            sign: sign
                        },
                        success: (res, txt, xhr) => {
                         
                        },
                        error: (e) => {
                        },
                    });
                },
                onchange(name, title) {
                    console.log(8888)
                    this.tabActive = title == "检修公告" ? 2 : title == "系统消息" ? 1 : 3

                },
                getUserMessage() {
                    const userId = sessionStorage.getItem("userId");
                    let param = {
                        "userId": userId,
                        "timestamp": new Date().getTime() + "",
                    };
                    let AuthenticationSession = sessionStorage.getItem("Authentication");
                    data = JSON.stringify(param)
                    let sign = sm3(data);
                    $.ajax({
                        url: localUrlLink + iscp_port +
                            "/tjAiAssistant/userMessage/getUserMessage",
                        type: "post",
                        // async: false, //是否同步，false表示同步请求
                        dataType: "json",
                        data: data,
                        headers: {
                            "Content-Type": "application/json;charset=UTF-8",
                            Authentication: AuthenticationSession,
                            sign: sign
                        },
                        success: (res, txt, xhr) => {
                         if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                                let Authentication = xhr.getResponseHeader("Authentication")
                                if (res.code == 200) {
                                    if (Authentication) {
                                        sessionStorage.setItem("Authentication",
                                            Authentication);
                                    }
                                    console.log(1111,res)
                                    if(res.resultValue.announcementRead) {
                                        res.resultValue.announcementList = []
                                        } 
                                    if(res.resultValue.versionRead) {
                                        res.resultValue.versionList = []
                                        }
                                    if(res.resultValue.sysMsgRead) {
                                        res.resultValue.sysMsgList = []
                                        }
                                    console.log(JSON.stringify(res.resultValue))
                                    this.tabData = this.generateTabData(res.resultValue)
                                    if(this.tabData.length > 0) {
                                         this.showShare = true
                                    }  else {
                                        this.showShare = false
                                    }

                                }
                            }
                        },
                        error: (e) => {},
                    });
                },
                /**
                 * 处理后端返回的消息列表，生成按指定顺序排列的 tabData 数组
                 * @param {Object} backendData - 后端返回的原始数据（需包含 resultValue 字段）
                 * @returns {Array} tabData - 按规则排序后的最终数组
                 */

                generateTabData(backendData) {
                    const listConfig = [
                        'announcementList', // 优先级1：公告列表
                        'versionList', // 优先级2：版本列表
                        'sysMsgList' // 优先级3：系统消息列表
                    ];

                    // 2. 筛选非空列表的第一项，按优先级组成数组（简洁化循环逻辑）
                    const table = listConfig.reduce((result, listKey) => {
                        // 安全获取当前列表：避免 backendData 不存在或列表字段不存在的情况
                        const currentList = backendData ?.[listKey] || [];
                        // 若列表非空，取第一项加入结果
                        if (Array.isArray(currentList) && currentList.length > 0) {
                            result.push(currentList[0]);
                        }
                        return result;
                    }, []);

                    this.tabActive = table.length > 0 ? table[0].messageType : 2; // 空时设为 null（或根据业务设默认值）

                    return table;
                },

                shouldShowComponent(active) {
                    return [0, 1, 2].includes(active)
                },
                close() {
                    if (!isFlag) {
                        closeIscp();
                    }
                    IscLogout()
                    wx.closeWindow();

                },
                changeAct() {
                    sessionStorage.setItem("activeNum", this.active);
                }
            },
        });
    </script>

</body>

</html>